let detailsModule = {
	namespaced: true,    //开启命名空间
	state: {
		datas: "",//详情页数据
		skuBool: false,//是否显示sku模块
		goodsList: JSON.parse(localStorage.getItem("goodsList")) || []//商品信息列表
	},
	getters: {
		getAllCount(state) {
			let count = 0
			state.goodsList.forEach((item) => {
				count += item.num
			})
			return count
		}
	},
	mutations: {
		["GET_DATAS"](state, data) {
			state.datas = data
		},
		["SHOW_SKU"](state) {//显示sku模块
			state.skuBool = true
		},
		["CLOSE_SKU"](state) {//关闭sku模块
			state.skuBool = false
		},

		["REMOVE"](state, list) {//删除购物车数据
			state.goodsInfoList = list
			sessionStorage.setItem("goodsInfoList", JSON.stringify(state.goodsInfoList))
		}
	}
}

export default detailsModule